package com.bdqn.jiang.Service.impl;

import com.bdqn.jiang.Service.BaseService;
import com.bdqn.jiang.entity.Leibiao;
import com.bdqn.jiang.entity.User;
import com.bdqn.jiang.utils.ServiceFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class leixServiclml implements BaseService {
    Scanner sc = new Scanner(System.in);



    ArrayList list1 = new ArrayList();
    ArrayList list2 = new ArrayList();

    public leixServiclml() {


    }

    @Override
    public void execute(List<User> list) {

        Leibiao leibiao1 = new Leibiao("雪山飞狐", "金庸", "长篇小说");
        Leibiao leibiao2 = new Leibiao("顾下金玉", "赵栋", "长篇小说");
        Leibiao leibiao3 = new Leibiao("八仙过海七仙女", "老子", "短篇小说");
        list1.add(leibiao1);
        list1.add(leibiao2);
        list1.add(leibiao3);


        Leibiao lei1 = new Leibiao("仙剑奇侠传", "张之栋", "长篇小说");
        Leibiao lei2 = new Leibiao("火云邪神", "赵栋", "长篇小说");
        Leibiao lei3 = new Leibiao("女娲补天", "小小栋", "短篇小说");
        list2.add(lei1);
        list2.add(lei2);
        list2.add(lei3);

        for (;;){
        System.out.println("0:退出登录");
        System.out.println("1:言情");
        System.out.println("2:武侠");
        System.out.println("----------------------------");
        System.out.println("请选择:");
        int Lxz = sc.nextInt();
        if (Lxz == 1) {
            System.out.println("----------言情小说开始----------");
            for (int i = 0; i < list1.size(); i++) {
                Leibiao leibiao = (Leibiao) list1.get(i);
                System.out.println((i + 1) + "\t"+ leibiao.getUsername() + "\t" + leibiao.getName() + "\t" + leibiao.getJianjie());
            }
            BaseService baseService = ServiceFactory.getService("GetNove");
            baseService.execute(list1);


        } else if (Lxz == 2) {


            System.out.println("----------武侠小说开始----------");
            for (int i = 0; i < list2.size(); i++) {
                Leibiao leibiao = (Leibiao) list2.get(i);
                System.out.println((i + 1) + "\t"+ leibiao.getUsername() + "\t" + leibiao.getName() + "\t" + leibiao.getJianjie());
            }
            BaseService baseService = ServiceFactory.getService("GetNove");
            baseService.execute(list2);
    }else{
            System.out.println("退出成功");
                break;
        }

        }
    }

}
